package com.example.feifei.mvvm.viewmodel;

import android.app.Activity;
import android.databinding.ViewDataBinding;
import android.view.View;

import com.example.feifei.mvvm.model.UserInfoBean;
import com.example.feifei.net.CallBackSubscriber;
import com.example.feifei.net.MySubscriber;
import com.example.feifei.utils.ToastUtil;


/**
 * viewModel,再次进行业务处理
 * Created by Administrator on 2018\9\25 0025.
 */

public class UserViewModel {
    private Activity activity;
    private ViewDataBinding binding;
    public UserInfoBean infoBean;
    MySubscriber loader;

    public UserViewModel(Activity activity, ViewDataBinding binding) {
        this.activity = activity;
        this.binding = binding;
//        this.binding.setVariable(user,this);
    }
    //设置模拟数据
    public void setInfoBean(UserInfoBean infoBean) {
        this.infoBean = infoBean;
    }
    //设置业务逻辑
    public void onBtnClick(View view){
        ToastUtil.showMessage(activity,"点了我一下");
    }

    public void doNetRequest(){
        loader = new MySubscriber();
        loader.getRxNetString().subscribe(new CallBackSubscriber<String>(){
            @Override
            public void onNext(String s) {

            }
        });
    }



}
